{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e10c6deb",
   "metadata": {},
   "outputs": [],
   "source": [
    "#对比度自适应\n",
    "import numpy as np\n",
    "import cv2 as cv\n",
    "\n",
    "img = cv.imread('../data/tsukuba_l.png',0)\n",
    "# create a CLAHE object (Arguments are optional).创建clahe对象\n",
    "#cliplimimt截断限制值 titleGridSize 图像被分割后的区域宽、高个数\n",
    "clahe = cv.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))\n",
    "#对原图进行clahe处理 img输入 c11处理后的图像\n",
    "cl1 = clahe.apply(img)\n",
    "# cv.imwrite('clahe_2.jpg',cl1)\n",
    "\n",
    "res = np.hstack((img,cl1))\n",
    "cv.imshow(\"res\", res)\n",
    "cv.waitKey(0)\n",
    "\n",
    "cv.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "585de4e9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
